package com.wutong.eams.enums;

import lombok.Getter;

public enum Role {
    ADMIN("admin" ,3),
    STUDENT("student", 1),
    TEACHER("teacher", 2),
    USER("user", 4);

    @Getter
    private final String roleName;
    @Getter
    private final int roleValue;

    Role(String roleName, int roleValue) {
        this.roleName = roleName;
        this.roleValue = roleValue;
    }

    public static Role getByName(String name) {
        for (Role role : Role.values()) {
            if (role.getRoleName().equals(name)) {
                return role;
            }
        }
        return STUDENT;
    }


}
